package org.codeart.strategy.example03;

import org.codeart.strategy.pojo.Receipt;
import org.codeart.strategy.pojo.ReceiptBuilder;

import java.util.List;

public class Client {

    public static void main(String[] args) {
        List<Receipt> list = ReceiptBuilder.build();
        ReceiptContext context = new ReceiptContext();
        ReceiptHandleStrategyFactory factory = new ReceiptHandleStrategyFactory();
        list.forEach(r -> {
            ReceiptHandleStrategy strategy = factory.get(r);
            context.setStrategy(strategy);
            context.handleReceipt(r);
        });
    }

}
